package com.pretty.adminapp.pojo.base;

import java.io.Serializable;

public class ResponseResult<T> implements Serializable {

	private static final long serialVersionUID = -4122709598010253542L;

	private int code = Status.OK.getCode();

	private String message = "ok";

	private T result;

	public ResponseResult() {
	}

	public ResponseResult(T result) {
		this.result = result;
	}

	public ResponseResult(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(T result) {
		this.result = result;
	}

	@Override
	public String toString() {
		return "ResponseResult [code=" + code + ", message=" + message + ", result=" + result + "]";
	}

	public static enum Status {

		OK(200, "OK"), FAILED(-1, "FAILED"), UNAUTHORIZED(401, "Unauthorized"), SESSION_TIMEOUT(911, "Session Timeout");

		private int code;

		private String reason;

		Status(int code, String reason) {
			this.code = code;
			this.reason = reason;
		}

		public int getCode() {
			return code;
		}

		public String getReason() {
			return reason;
		}

	}

}
